package com.tuanzi.loan.web.bean.family;

import com.tuanzi.loan.vo.request.family.PartnerBalanceSearchRequest;
import com.tuanzi.loan.vo.response.family.PartnerBalanceSearchResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.family.PartnerBalanceDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;

/**
 * 合作方余额
 * @author JinRuiyang 2017/11/30
 */
@Data
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class PartnerBalanceBean extends JSFListingBean<PartnerBalanceSearchRequest, PartnerBalanceSearchResponse> {

    @PostConstruct
    private void init() {
        initLazyDataModel();
    }

    public void onReset() {
        initLazyDataModel();
    }

    public void onRefresh(){
        lazyDataModel = new PartnerBalanceDataModel($);
        addSuccessfullyMessage();
    }

    private void initLazyDataModel() {
        $ = new PartnerBalanceSearchRequest();
        lazyDataModel = new PartnerBalanceDataModel($);
    }
}
